package com.igeek.boot.mapper;

import com.igeek.boot.entity.Shelves;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jwj
 * @since 2023-12-26
 */
@Mapper
public interface ShelvesMapper extends BaseMapper<Shelves> {

    @Select("select * from shelves where warehouse_id = #{warehouseId}")
    @Results({
            @Result(id=true,column="shelfID",property="shelfID"),
            @Result(property = "assets" , column = "shelfID",
                    javaType = java.util.List.class,
                    many = @Many(select = "com.igeek.boot.mapper.AssetsMapper.selectAssetsByShelfId"))
    })
    List<Shelves> selectShelvesByWarehouseId(Integer warehouseId);

}
